from typing import List


class Solution:
    def subsetsWithDup(self, nums: List[int]) -> List[List[int]]:
        path = []
        result = set()

        def backtracking(start_index):
            # if start_index == len(nums):
            #     result.add(tuple(path[:]))
            #     return

            result.add(tuple(path[:]))
            for i in range(start_index, len(nums)):
                path.append(nums[i])
                backtracking(i + 1)
                path.pop()

        backtracking(0)
        return list(map(lambda x: list(x), result))


if __name__ == '__main__':
    s = Solution()
    result = s.subsetsWithDup([1, 2, 2])
    print(result)
